#!/bin/bash

output_dir="docker-images-tar"
image_list_file="$output_dir/image-list.txt"

if [ ! -f "$image_list_file" ]; then
    echo "Image list file $image_list_file not found!"
    exit 1
fi

while IFS= read -r tar_file; do
    if [ -f "$tar_file" ]; then
        echo "Loading image from $tar_file ..."
        docker load -i "$tar_file"
    else
        echo "Tar file $tar_file not found, skipping."
    fi
done < "$image_list_file"

echo "All images loaded."
